package com.homework.service;

import java.sql.SQLException;
import java.util.List;

import com.homework.bean.CourseBean;
import com.homework.bean.CourseListBean;
import com.homework.bean.PageInfoBean;
import com.homework.bean.UserBean;
import com.homework.bean.UserCourseListBean;
import com.homework.dao.CourseDao;

public class CourseService {
	private static CourseService courseService = null;
	private CourseDao courseDao;

	public CourseService() {
		this.courseDao = CourseDao.getInstance();
	}

	public static CourseService getInstance() {
		if (courseService == null) {
			courseService = new CourseService();
		}
		return courseService;
	}

	// 班级列表
	public CourseListBean classShow(UserBean userBean, PageInfoBean pageInfoBean)
			throws SQLException {
		return courseDao.classShow(userBean, pageInfoBean);
	}

	// 班级查询
	public CourseListBean classQuery(UserBean userBean, CourseBean courseBean,
			PageInfoBean pageInfoBean) throws SQLException {
		return courseDao.classQuery(userBean, courseBean, pageInfoBean);
	}

	// 新增班级
	public void classAdd(CourseBean courseBean, UserBean userBean)
			throws SQLException {
		courseDao.classAdd(courseBean, userBean);
	}

	// 删除班级_教师
	public void classDelete_teacher(CourseBean courseBean) throws SQLException {
		courseDao.classDelete_teacher(courseBean);
	}

	// 删除班级_学生
	public void classDelete_student(CourseBean courseBean, UserBean userBean)
			throws SQLException {
		courseDao.classDelete_student(courseBean, userBean);
	}

	// 班级恢复_老师删除的班级
	public void classRecovery_teacher(CourseBean courseBean) throws NumberFormatException, SQLException {
		courseDao.classRecovery_teacher(courseBean);
	}

	// 选课列表
	public UserCourseListBean classChooseShow(UserBean userBean,
			PageInfoBean pageInfoBean) throws SQLException {
		return courseDao.classChooseShow(userBean, pageInfoBean);
	}

	// 选课列表_查询
	public UserCourseListBean classChooseQuery(UserBean userBean,
			PageInfoBean pageInfoBean, CourseBean courseBean)
			throws SQLException {
		return courseDao.classChooseQuery(userBean, pageInfoBean, courseBean);
	}

	// 提交选课
	public int classChoose(UserBean userBean, List<Integer> courseIdList)
			throws SQLException {
		return courseDao.classChoose(userBean, courseIdList);
	}
}
